<template>
  <div class="content">
    <h2>showInfo {{props.name}} - {{props.age }}</h2>
    <button @click="showInfoClick">showInfo点击</button>
  </div>
</template>

<script setup>
  const props = defineProps({
    name: {
      type: String,
      default: "默认值"
    },
    age: {
      type: Number,
      default: 0
    }
  })

  // 绑定函数,发出事件
  const emits = defineEmits(["showInfoClick"])
  function showInfoClick() {
    emits("showInfoClick", "发生了点击")
  }

  function foo() {
    console.log("foo函数")
  }

  defineExpose({
    foo
  })
</script>

<style scoped>
</style>